﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace NewsEntity.Migrations
{
    public partial class InitialCreate : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Adminlogin",
                columns: table => new
                {
                    id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    UserName = table.Column<string>(nullable: true),
                    PassWord = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Adminlogin", x => x.id);
                });

            migrationBuilder.CreateTable(
                name: "BannerManager",
                columns: table => new
                {
                    ID = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Image = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    Url = table.Column<string>(unicode: false, maxLength: 100, nullable: true),
                    AddTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    Remark = table.Column<string>(unicode: false, maxLength: 50, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_BannerManager", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NewInfo",
                columns: table => new
                {
                    ID = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    NewsId = table.Column<int>(nullable: true),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: true),
                    Remarks = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    Content = table.Column<string>(type: "text", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NewInfo", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "News",
                columns: table => new
                {
                    ID = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    InfoType = table.Column<int>(nullable: true),
                    NewsTitle = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    NewsContent = table.Column<string>(type: "text", nullable: true),
                    PublishDate = table.Column<DateTime>(type: "datetime", nullable: true),
                    Remark = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    Image = table.Column<string>(unicode: false, maxLength: 60, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_News", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NewsType",
                columns: table => new
                {
                    TypeId = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    TypeName = table.Column<string>(unicode: false, fixedLength: true, maxLength: 20, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NewsType", x => x.TypeId);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Adminlogin");

            migrationBuilder.DropTable(
                name: "BannerManager");

            migrationBuilder.DropTable(
                name: "NewInfo");

            migrationBuilder.DropTable(
                name: "News");

            migrationBuilder.DropTable(
                name: "NewsType");
        }
    }
}
